package xin.marcher.module.common.enums.lifecycle;

import java.util.HashMap;
import java.util.Map;

/**
 * 生命周期考核结果枚举
 */
public enum MarketExpriResultEnum {

    /**
     * 考核中
     */
    UNDER_EXAMINATION(0, "考核中"),

    /**
     * 考核通过
     */
    PASS_EXAMINATION(1, "考核通过"),

    /**
     * 考核不通过
     */
    FAIL_PASS_EXAMINATION(2, "考核不通过"),

    /**
     * 不考核或暂停考核
     */
    NON_EXAMINATION(3, "不考核或暂停考核");

    private Integer code;

    private String value;

    MarketExpriResultEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (MarketExpriResultEnum element : MarketExpriResultEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static MarketExpriResultEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (MarketExpriResultEnum element : MarketExpriResultEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }

}
